﻿using System;

using SBPweb.Forge.Contracts.Components;

using SBPweb.Communication.Shared.Library.Configuration;

namespace SBPweb.Communication.Shared.Library.Commands
{

    public interface ICommandManager : IInitializable, IConfigurationDescriptorApplicant<ICommandManagerConfiguration>
    {

        #region Events

        event EventHandler<CommandBaseCancelEventArgs> CommandSending;

        event EventHandler<CommandBaseEventArgs> CommandSent;

        #endregion

        #region Methods

        void SendCommand(ICommand command);

        void SendCommand(CommandBase command);

        void RegisterCommandHandler<TCommand>(EventHandler<CommandBaseEventArgs<TCommand>> handler)
            where TCommand : CommandBase;

        void UnregisterCommandHandler<TCommand>(EventHandler<CommandBaseEventArgs<TCommand>> handler)
            where TCommand : CommandBase;

        #endregion

    }

}